<template>
  <div class="h-tab">
    <div class="logo">
      <image class="logo-icon" src="/static/img/logo.png"> </image>
    </div>
    <div class="tab-ul">
      <div class="tab-li"
           :class="{'active': props.modelValue === 0}"
           @click="onTab(0)"
      >职位</div>
      <div class="slide"></div>
      <div class="tab-li"
           :class="{'active': props.modelValue === 1}"
           @click="onTab(1)"
      >人才库</div>
      <div class="slide"></div>
      <div class="tab-li"
           :class="{'active': props.modelValue === 2}"
           @click="onTab(2)"
      >学习圈</div>
      <div class="active-li" :style="activeLiStyle"></div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import {computed, ref} from "vue";
import BTab from "./BTab.vue";

const props = defineProps({
  modelValue: {
    type: Number,
    default: 0
  },
})
const emits = defineEmits(['update:modelValue'])
const onTab = (index:number) => {
  // uni.navigateTo({
  //   url: '/pages/index/index'
  // })
  emits('update:modelValue', index)
}
const activeLiStyle = computed(() => {
  console.log(props.modelValue * 200)
  return {left: props.modelValue * 200 + 'rpx'}
})

</script>

<style scoped lang="scss" >
.h-tab {
  position: sticky;
  top: 0;
  height: 114rpx;
  display: flex;
  align-items: center;
  padding: 0 44rpx;
  z-index: 99;
  background: white;
  .logo {
    .logo-icon {
      width: 92rpx;
      height: 92rpx;
      box-shadow: 0 4rpx 20rpx 0 rgba(228,255,89,0);
      border: 2rpx solid rgba(0,0,0,0.08);
      border-radius: 50%;
    }
  }
}

.tab-ul {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  //margin: 0 80rpx;
  .tab-li {
    width: 200rpx;
    height: 44rpx;
    font-size: 32rpx;
    font-weight: 300;
    color: #0D3333;
    line-height: 44rpx;
    text-align: center;
    z-index: 9;
    //cursor: pointer;
    &.active {
      color: #000000;
    }
  }
  .slide {
    width: 2rpx;
    height: 24rpx;
    background: rgba(0, 0, 0, 0.25);
  }
  .active-li {
    width: 200rpx;
    height: 16rpx;
    position: absolute;
    bottom: -5rpx;
    transition:all 0.2s ease-in-out;
    &:after {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      content: '';
      width: 156rpx;
      height: 16rpx;
      background: #24FAF6;
      border-radius: 20rpx;
    }


  }
}
</style>
